<?php

class Retailer_Backend_Block_Adminhtml_Account_Edit_Tab_Password extends Mage_Adminhtml_Block_Widget_Form
{
  protected function _prepareForm()
  {
      $form = new Varien_Data_Form();
      $this->setForm($form);
      $form->setDataObject(Mage::registry('backend_data'));
      
      $fieldset = $form->addFieldset('backend_form', array('legend'=>Mage::helper('backend')->__('Account information')));
      
      $fieldset->addField('username', 'text', array(
          'label'     => Mage::helper('backend')->__('Username'), //Mage::getModel('admin/user')->load($session->getId())->getId()
          //'class'     => 'required-entry',
          'required'  => true,
          'name'      => 'username',
      ));

      $fieldset->addField('password', 'password', array(
          'label'     => Mage::helper('backend')->__('Password (must be at least 7 characters with at least 1 number)'), //Mage::getModel('admin/user')->load($session->getId())->getId()
          //'class'     => 'required-entry',
          'required'  => true,
          'name'      => 'password',
      ));
      $fieldset->addField('cpassword', 'password', array(
          'label'     => Mage::helper('backend')->__('Confirm Password'), //Mage::getModel('admin/user')->load($session->getId())->getId()
          //'class'     => 'required-entry',
          'required'  => true,
          'name'      => 'cpassword',
      ));

      $fieldset->addField('email', 'text', array(
          'label'     => Mage::helper('backend')->__('Email Address'),
          'required'  => true,
          'name'      => 'email',
      ));
//      $fieldset->addField('username', 'text', array(
//          'label'     => Mage::helper('backend')->__($model),
//          'required'  => true,
//          'name'      => 'username',
//      ));
//
//     $fieldset->addField('password', 'text', array(
//          'label'     => Mage::helper('backend')->__('Password(security reasons)'),
//          'required'  => true,
//          'name'      => 'password',
//      ));
//
        $roles = Mage::getModel('admin/roles')->getCollection();
        foreach($roles as $role){
            $values[]=array(
                'value'=> $role->getId(),
                'label'=> $role->getRoleName(),
            );
        }
      $fieldset->addField('role', 'select', array(
          'label'     => Mage::helper('backend')->__('Role'),
          'name'      => 'role',
          'values'    => $values,
      ));

      $sites = Mage::getModel('core/website')->getCollection();
        foreach($sites as $site){
            $webvalues[]=array(
                'value'=> $site->getId(),
                'label'=> $site->getName(),
            );
        }
      $fieldset->addField('site', 'select', array(
          'label'     => Mage::helper('backend')->__('Website'),
          'name'      => 'site',
          'values'    => $webvalues,
      ));

//      $fieldset->addField('webname', 'text', array(
//          'label'     => Mage::helper('backend')->__('Name of new Website (optional)'), //Mage::getModel('admin/user')->load($session->getId())->getId()
//          //'class'     => 'required-entry',
//          'required'  => false,
//          'name'      => 'webname',
//      ));
//
//      $fieldset->addField('webid', 'text', array(
//          'label'     => Mage::helper('backend')->__('Website ID'), //Mage::getModel('admin/user')->load($session->getId())->getId()
//          //'class'     => 'required-entry',
//          'required'  => false,
//          'name'      => 'webid',
//      ));
//
//      $fieldset->addField('content', 'editor', array(
//          'name'      => 'content',
//          'label'     => Mage::helper('backend')->__('Content'),
//          'title'     => Mage::helper('backend')->__('Content'),
//          'style'     => 'width:700px; height:500px;',
//          'wysiwyg'   => false,
//          'required'  => false,
//      ));
                
     
      if ( Mage::getSingleton('adminhtml/session')->getBackendData() )
      {
          $form->setValues(Mage::getSingleton('adminhtml/session')->getBackendData());
          Mage::getSingleton('adminhtml/session')->setBackendData(null);
      } elseif ( Mage::registry('backend_data') ) {
          $form->setValues(Mage::registry('backend_data')->getData());
      }
      return parent::_prepareForm(); 
  }
}